﻿using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace OrderServiceTest
{
    [TestClass]
    public class UnitTest1
    {
        [TestMethod]
        public void TestAdd()
        { 
            Good good1 = new Good("banana", 848);
            Good good2 = new Good("apple", 666);
            Good good3 = new Good("milk", 55);
            Client client1 = new Client("XB");
            Client client2 = new Client("TLM");
            Client client3 = new Client("ZRZ");
            Order list1 = new Order(233, client1, new List<OrderDetails>());
            list1.Details.Add(new OrderDetails(good1, 3));
            list1.Details.Add(new OrderDetails(good2, 4));

            OrderService master = new OrderService();
            master.add(list1);

            String a = master.QueryByOid(233);
            String b = "OID为233订单为：\n------------------------------\nOrder id = 233\nClient: XB:\n            total price = 5208\nDetails are below:\n            单价为848的banana 3件\n            单价为666的apple 4件\n";
            CollectionAssert.AreEqual(a, b);
        }
    }
}
